using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MoleCart.Core.Common {
	/// <summary>
	/// 分页类
	/// </summary>
	/// <typeparam name="T"></typeparam>
	/// Create by jerry. 2011/6/27 11:58
	public class PaginatedList<T> : List<T> {
		/// <summary>
		/// 当前页号
		/// </summary>
		public int PageIndex { get; private set; }
		/// <summary>
		/// 每页记录数
		/// </summary>
		public int PageSize { get; private set; }
		/// <summary>
		/// 记录总数
		/// </summary>
		public int RecordCount { get; private set; }
		/// <summary>
		/// 页总数
		/// </summary>
		public int PageCount { get; private set; }
		/// <summary>
		/// 记录开始行号
		/// </summary>
		public int StartRow { get; private set; }
		/// <summary>
		/// 记录结束行号
		/// </summary>
		public int EndRow { get; private set; }

		/// <summary>
		/// Initializes a new instance of the <see cref="PaginatedList&lt;T&gt;"/> class.
		/// </summary>
		/// <param name="pageIndex">Index of the page.</param>
		/// <param name="pageSize">Size of the page.</param>
		/// <param name="recordCount">The record count.</param>
		/// Create by jerry. 2011/6/27 12:50
		public PaginatedList(int pageIndex, int pageSize, int recordCount) {
			int startRow, endRow, pageCount;
			CommonLib.CPage(pageIndex, pageSize, recordCount, out startRow, out endRow, out pageCount);
			PageIndex = pageIndex;
			PageSize = pageSize;
			RecordCount = recordCount;
			StartRow = startRow;
			EndRow = endRow;
			PageCount = pageCount;
		}

	}
}
